#include <stdio.h>
#include "crc-itu-t.h"
#define MAGIC_CRC           0x1E50
int main()
{
	unsigned short				crc_rt;
	unsigned char				buf[2]={'a','2'};
	unsigned int				length=2;
	crc_rt=crc_itu_t(MAGIC_CRC,buf,1);//计算crc值
	printf("is one :%d\n",crc_rt);

	crc_rt=crc_itu_t(MAGIC_CRC,buf,2);//计算crc值
	printf("is two:%d\n",crc_rt);
	return 0;
}
/*函数设计的大概功能：将发送过来的crc与计算出的crc进行校验*/
void crc_check(pack_tlv cline_crc);
{
	unsigned short				crc_check_rt;
	unsigned char				*cline_buf_pointer;//指针指向数组用于crc_itu_t()计算的参数
	unsigned int				length;

	cline_buf_pointer=cline_crc->buf;//下面这段为伪代码，具体看客户端的封装来改
	length=cline_crc->length;
	crc_rt=crc_itu_t(MAGIC_CRC,cline_buf_pointer,length);//计算crc值
	printf("is one :%d\n",crc_rt);
    
	if(crc_rt!=cline_crc->crc)//计算值crc与读取的crc进行对比
	{
		printf("the data is bad value!\n");
	}
	else
		printf("crc check successful!\n");
}
